package com.zzb.dao.impl;

import com.zzb.dao.NewsDao;
import com.zzb.entity.NewsEntity;
import com.zzb.util.MyBatisUtils;

import java.util.List;

public class NewsDaoImpl implements NewsDao {
    @Override
    public NewsEntity findByName(NewsEntity newsEntity) {
        NewsDao newsDao = MyBatisUtils.getMapper(NewsDao.class);
        return newsDao.findByName(newsEntity);
    }

    @Override
    public int add(NewsEntity newsEntity) {
        NewsDao newsDao = MyBatisUtils.getMapper(NewsDao.class);
        return newsDao.add(newsEntity);
    }

    @Override
    public int delete(NewsEntity newsEntity) {
        NewsDao newsDao = MyBatisUtils.getMapper(NewsDao.class);
        return newsDao.delete(newsEntity);
    }

    @Override
    public NewsEntity findById(NewsEntity newsEntity) {
        NewsDao newsDao = MyBatisUtils.getMapper(NewsDao.class);
        return newsDao.findById(newsEntity);
    }

    @Override
    public List<NewsEntity> findAll(NewsEntity newsEntity) {
        NewsDao newsDao = MyBatisUtils.getMapper(NewsDao.class);
        return newsDao.findAll(newsEntity);
    }

    @Override
    public int update(NewsEntity newsEntity) {
        NewsDao newsDao = MyBatisUtils.getMapper(NewsDao.class);
        return newsDao.update(newsEntity);
    }

    @Override
    public int count(NewsEntity newsEntity) {
        NewsDao newsDao = MyBatisUtils.getMapper(NewsDao.class);
        return newsDao.count(newsEntity);
    }
}
